﻿@model IPagedList<Infinity.Models.Lab>

@{
    ViewBag.Title = "Index";
    Layout = "~/Areas/Managerial/Views/Shared/_AdminLayout.cshtml";
}
@using PagedList;
@using PagedList.Mvc;

<h2>Index</h2>


<p>   
     @using (Html.BeginForm("Index","Lab",FormMethod.Get ))
     {                                                                           
    <b>Seaech By:</b> @Html.Label("Lab Name") 
                     
    <br />
    @Html.TextBox("search") <input type="submit" value="Search" class="submit"/>
     }


</p>
<table >
    <tr>
          <th>
            @Html.DisplayNameFor(model => model.First().LabID)
        </th>
        <th>
            @Html.DisplayNameFor(model => model.First().Lab_Name)
        </th>
        
        <th>
            @Html.DisplayNameFor(model => model.First().Branch.Address)
        </th>
        <th></th>
    </tr>

@foreach (var item in Model) {
    using (Html.BeginForm("Delete","Lab",new{id=item.LabID}))
    {
    <tr>
         <td>
            @Html.DisplayFor(modelItem => item.LabID)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.Lab_Name)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.Branch.Address)
        </td>
        <td>
            
            @Html.ActionLink("Edit", "Edit", new { id = item.LabID }, new { @class="buttonstyle"}) |
@*            @Html.ActionLink("Delete", "Delete", new {  id=item.LabID }, new { @class="buttonstyle"})*@
             <input type="submit" value="Delete" class="buttonstyle" onclick="return confirm('Are you sure you  want to delete This')"; />


        </td>


    </tr>
}
}

</table>
 <table>
        <tr>
            <td>@Html.PagedListPager(Model, page => Url.Action("Index", new { page, searchBy = Request.QueryString["searchBy"], search = Request.QueryString["search"] }))</td>
            
            <td>&nbsp;&nbsp; @Html.ActionLink("Create New Lab", "Create",null, new { @class="buttonstyle"})</td>
        </tr>
    </table>


